package com.baidu.controller;

import com.baidu.model.entity.MarkModel;
import com.baidu.service.impl.MarkControllerServiceImpl;
import com.until.pagination.PaginationRequest;
import com.until.response.RestfulCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 圈人功能的controller功能代码实现
 * @author user
 */
@RestController
@RequestMapping("mark")
public class MarkController {
    @Autowired
    private MarkControllerServiceImpl markControllerService;

    @PostMapping("")
    public RestfulCode.CodeSatCode createMark(@RequestBody MarkModel markModel){
        return markControllerService.createMark(markModel);
    }

    @GetMapping("{id}")
    public RestfulCode.CodeSatCode selectMarkByPhotoId(PaginationRequest paginationRequest, @PathVariable Integer id){
        return markControllerService.selectMarkByPhotoId(paginationRequest,id);
    }

    @PutMapping("{id}")
    public RestfulCode.CodeSatCode updateMarkById(@RequestBody MarkModel markModel,@PathVariable Integer id){
        markModel.setId(id);
        return markControllerService.updateMarkById(markModel);
    }

    @DeleteMapping("{id}")
    public RestfulCode.CodeSatCode deleteMarkById(@PathVariable Integer id){
        return markControllerService.deleteMarkById(id);
    }
}
